package com.sky.mapper;

import com.sky.entity.Proposal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProposalMapper {
    @Insert("INSERT INTO proposal (nick_name, phone_number, proposal_type, content, create_time, update_time) " +
            "VALUES (#{nickName}, #{phoneNumber}, #{proposalType}, #{content}, #{createTime}, #{updateTime})")
    void insert(Proposal proposal);

    @Select("SELECT * FROM proposal ORDER BY create_time DESC")
    List<Proposal> list();

    @Delete("DELETE FROM proposal WHERE id = #{id}")
    void deleteById(Long id);
}